package com.mindskip.xzs.controller.student;

import com.mindskip.xzs.context.WebContext;
import com.mindskip.xzs.domain.vo.student.education.SubjectVO;
import com.mindskip.xzs.service.SubjectService;
import com.mindskip.xzs.utility.RestResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("StudentEducationController")
@RequestMapping(value = "/api/student/education")
public class EducationController {

    private final SubjectService subjectService;

    private final WebContext webContext;
    public EducationController(SubjectService subjectService, WebContext webContext) {
        this.subjectService = subjectService;
        this.webContext = webContext;
    }

    @PostMapping("/subject/list")
    public RestResponse<List<SubjectVO>> list() {

        List<SubjectVO> subjectVO = subjectService.getSubjectVOByLevel(webContext.getCurrentUser().getUserLevel());
        return RestResponse.ok(subjectVO);
    }
}
